package cn.beatuty.makeup.module.system.dal.mysql.articlelike;

import java.util.*;

import cn.beatuty.makeup.framework.common.pojo.PageResult;
import cn.beatuty.makeup.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.beatuty.makeup.framework.mybatis.core.mapper.BaseMapperX;
import cn.beatuty.makeup.module.system.controller.admin.articlelike.vo.ArticleLikePageReqVO;
import cn.beatuty.makeup.module.system.dal.dataobject.articlelike.ArticleLikeDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 文章点赞 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface ArticleLikeMapper extends BaseMapperX<ArticleLikeDO> {

    default PageResult<ArticleLikeDO> selectPage(ArticleLikePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ArticleLikeDO>()
                .eqIfPresent(ArticleLikeDO::getArticleId, reqVO.getArticleId())
                .eqIfPresent(ArticleLikeDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(ArticleLikeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ArticleLikeDO::getId));
    }

}